package com.cl.mypureframe.model;

import androidx.annotation.NonNull;

import com.cl.photozoom.ui.PhotoViewInterface;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
 * @Class: PhotoMod
 * @Description:
 * @Author: ChenLei
 * @Date: 2020/12/7---14:00
 */
public class PhotoMod implements PhotoViewInterface {
    public static final int TYPE_ADD = 0;
    public static final int TYPE_NORMAL = 1;// 可删除带小叉叉
    public static final int TYPE_NORPIC = 2;//  纯展示
    public int randomHeight;// 随机高度
    public String id;
    public String title;
    public String msg;
    public String picurl;
    public int type;// 0. 未选择图片；1. 已有图片

    public PhotoMod(String picurl) {
        this.type = TYPE_NORMAL;
        this.picurl = picurl;
    }

    public PhotoMod(String picurl, int type) {
        this.picurl = picurl;
        this.type = type;
    }

    public PhotoMod() {
    }

    public static PhotoMod initData() {
        return new PhotoMod();
    }

    public static PhotoMod waterfallData(String picurl) {
        PhotoMod photoMod = new PhotoMod(picurl, TYPE_NORPIC);
        photoMod.randomHeight = new Random().nextInt(301) + 200;
        return photoMod;
    }

    public static PhotoMod gridData(String picurl) {
        return new PhotoMod(picurl, TYPE_NORPIC);
    }

    public static List<PhotoMod> initGridData() {
        List<PhotoMod> list = new ArrayList<>();
        for (int i = 0; i < 3; i++) {
            list.add(gridData("https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=3277823258,1545401798&fm=26&gp=0.jpg"));
            list.add(gridData("https://hbimg.huabanimg.com/1823e1c834d5a8f809e46923db9e2a992fafc888235f5d-fBYLF4_fw658/format/webp"));
            list.add(gridData("https://hbimg.huabanimg.com/d7b07c4b83bf6e752933cdd3f307d95e16121b5c2d599d-FJ34jo_fw658/format/webp"));
            list.add(gridData("https://hbimg.huabanimg.com/ab8e279ce2d85c0a23672df52eb0b845b0a186933e01d4-2eaZfD_fw658/format/webp"));
            list.add(gridData("https://hbimg.huabanimg.com/41abc7662635a292278f712eab3c7b3b86d8d0e23aaa3-NmzCtc_fw658/format/webp"));
            list.add(gridData("https://hbimg.huabanimg.com/866e90dde9ecd4187472675ff949728549c045838cb7-0lJ0GM_fw658/format/webp"));
            list.add(gridData("https://hbimg.huabanimg.com/918104e7c3ef930bb6b027260deaabcbb2d1492f8decc-TAiByv_fw658/format/webp"));
        }
        return list;
    }

    public static List<PhotoMod> initWaterfallData() {
        List<PhotoMod> list = new ArrayList<>();
        for (int i = 0; i < 3; i++) {
            list.add(waterfallData("https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=3277823258,1545401798&fm=26&gp=0.jpg"));
            list.add(waterfallData("https://hbimg.huabanimg.com/1823e1c834d5a8f809e46923db9e2a992fafc888235f5d-fBYLF4_fw658/format/webp"));
            list.add(waterfallData("https://hbimg.huabanimg.com/d7b07c4b83bf6e752933cdd3f307d95e16121b5c2d599d-FJ34jo_fw658/format/webp"));
            list.add(waterfallData("https://hbimg.huabanimg.com/ab8e279ce2d85c0a23672df52eb0b845b0a186933e01d4-2eaZfD_fw658/format/webp"));
            list.add(waterfallData("https://hbimg.huabanimg.com/41abc7662635a292278f712eab3c7b3b86d8d0e23aaa3-NmzCtc_fw658/format/webp"));
            list.add(waterfallData("https://hbimg.huabanimg.com/866e90dde9ecd4187472675ff949728549c045838cb7-0lJ0GM_fw658/format/webp"));
            list.add(waterfallData("https://hbimg.huabanimg.com/918104e7c3ef930bb6b027260deaabcbb2d1492f8decc-TAiByv_fw658/format/webp"));
        }
        return list;
    }

    @NonNull
    @Override
    public String toString() {
        return "PhotoMod{" +
                "picurl='" + picurl + '\'' +
                ", type=" + type +
                '}';
    }

    @Override
    public String getPicUrl() {
        return picurl;
    }
}
